<? 
	$title="Edit category"; 
	$pageid="5";
	$accessid="a00";
	
	require("required/dbconnect.php"); 
	require("required/function.php");
	require("required/header.php");
	
	
	
	$id=$_GET['id'];
	$get_info=mysql_query("select * from os_slider where id=$id");
	if(!empty($_GET['msg']))
	{
		if($_GET['msg']==2)
		{
			$msg="<img src='images/icons/tick.jpg' align='absmiddle'> <font color=green>Data deleted!</font>";
		}
		else
		{
			$msg="<img src='images/icons/tick.jpg' align='absmiddle'> <font color=green>Data created!</font>";
		}
	}
	else
	{
		$msg="";
	}
	if(mysql_num_rows($get_info)==0)
	{
		echo "No record found!!";
	}
	else
	{
		

	$a=mysql_fetch_array($get_info,MYSQL_ASSOC);
	
	if($a["pic"]=="")
	{
		$pic="empty";
		$piclink="noimage.jpg";
		$fix="";
	}
	else
	{
		$piclink="slider_".$a['id'].".gif";
		$width=$a['width'];
		$height=$a['height'];
		if($width>=600 or $height>=300)
		{
			if($width-$height>0)
			{
				$fix="width=600";
			}
			else
			{
				$fix="height=300";
			}						
		}
		else
		{
			$fix="width=$width";
		}
	}
	
	
	
?>
<table width="95%" cellpadding="2" cellspacing="1">

	<td valign="top">
	<?= $msg ?>
	<table width="100%">
	<tr>
		<td colspan="4"><div class="title">Edit Slide</div></td>
	</tr>
	
				</script>	
	<form action="slider_edit2.php" method="post" name="frm" onSubmit="return frmValidate(this)">
	<input type="hidden" value="<?= $id ?>" name="id">
	<tr>
		<td>Slide name</td><td>:</td><td><input class="text" type="text" name="slide_name" size="30" value="<?= $a['slide_name'] ?>" maxlength="200"></td>
	</tr>
	<tr>
		<td>URL</td><td>:</td><td><input class="text" type="text" name="url" size="30" value="<?= $a['url'] ?>" maxlength="200"></td>
	</tr>
	<tr>
		<td>Order ID</td><td>:</td><td><input class="text" type="text" name="order_id" size="2" value="<?= $a['order_id'] ?>" maxlength="3"> Sorting order branch list</td>
	</tr>
	
	<tr valign="top">
		<td width="31%" valign="top">Slide Picture</td><td>:</td><td><img src="../slider/<?= $piclink ?>" <?= $fix ?>><br>
		<a href="slider_upload_pic.php?id=<?= $id ?>">(Upload Picture)</a>
		</td>
	</tr>
	<tr valign="top">
		<td width="31%">Publish</td><td width="1%">:</td>
		<td width="68%">
		<?
			if($a['status']==0)
			{
				$slt1="selected";
				$slt2="";
			}
			else
			{
				$slt2="selected";
				$slt1="";	
			}
		?>
		<select name="status" class="text">
		<option value="1" <?= $slt2 ?>>Yes</option>
		<option value="0" <?= $slt1 ?>>No</option>
		</select></td>
	</tr>
	
	<tr>
		<td colspan="3" align="center"><br><input type="submit" value="update" class="button">  <input type="button" value="Back" class="button" onclick="window.open('slider_viewall.php','_self')"><br><br></td>
	</tr>
	
	</form>
	</table></td>
			
</table>
<? } require("required/footer.php"); ?>

